from fresh.utils.utils import *
from drf_yasg.utils import swagger_auto_schema
from drf_yasg import openapi
from rest_framework.decorators import api_view
from rest_framework.response import Response


@swagger_auto_schema(method='get', manual_parameters=get_schema_prams([
    ('phone', '手机号码', openapi.TYPE_NUMBER, True),
    ('smsCode', '验证码', openapi.TYPE_NUMBER, True),
]),
    responses={
        200: 'ok',
        'code': '1',
        'msg': 'success',
        'currPage': '1',
        'data': '''[{
            "name":名称,
            "b":年龄,
            addr: 籍贯
        }]'''

})
@api_view(['GET'])
def demo_demo(request):
    data = {
        'code': '1',
        'msg': 'success',
        'currPage': '1'}
    return Response(data)


@api_view(['GET'])
def demo_all(request):
    return Response([
        {"a":2},
        {"a":2}
    ])


@api_view(['GET'])
def demo_add(request):
    """
    示例API视图
    """
    data = {'message': 'Hello, World!'}
    return Response(data)
